home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: games.e V0.6B
- **
- ** General include file for programs using the Games Master System.
- **
- ** (C) Copyright 1996-1997 DreamWorld Productions.
- ** All Rights Reserved
- */
-
- OPT MODULE
- OPT EXPORT
- OPT PREPROCESS
-
- CONST LISTSTART = $4C495354, SKIPENTRY = 0, LISTEND = -1, ENDLIST = -1,
- TAGEND = 0, TAGS = $54414753, OBJECTLIST = $4F4C5354
-
- ->**************************************************************************
- ->* Tag and ID definitions.
-
- CONST ID_BOB = $4242, ID_MBOB = $4D42, ID_GAMESCREEN = $4753,
- ID_SOUND = $534D, ID_PICTURE = $5043, ID_CARDSET = $4352,
- ID_ANIM = $414D, ID_MAP = $4D50, ID_MOVIE = $4D56,
- ID_FILE = $464C, ID_SPRITE = $5350
-
- CONST TAGS_BOB = $54474242, TAGS_MBOB = $54474D42,
- TAGS_GAMESCREEN = $54474753, TAGS_SOUND = $5447534D,
- TAGS_PICTURE = $54475043, TAGS_CARDSET = $54474352,
- TAGS_ANIM = $5447414D, TAGS_MAP = $54474D50,
- TAGS_MOVIE = $54474D56, TAGS_SPRITE = $54475350
-
- ->**************************************************************************
- ->* Universal errorcodes returned by certain functions.
-
- ENUM ERR_OK, -> Function went OK.
- ERR_NOMEM, -> Not enough memory available
- ERR_NOPTR, -> Required pointer not present
- ERR_INUSE, -> Previous allocations have not been freed
- ERR_STRUCT, -> Structure version not supported or not found.
- ERR_FAILED, -> General failure
- ERR_FILE, -> File error, eg file not found.
- ERR_DATA, -> There is an error in the given data.
- ERR_SEARCH, -> A search routine failed to make a match.
- ERR_SCRTYPE, -> Screen Type not recognised.
- ERR_GPI, -> Trouble with initialising/using a GPI.
- ERR_RASTCOMMAND, -> Invalid raster command detected.
- ERR_RASTERLIST, -> Complete rasterlist failure.
- ERR_NORASTER, -> Rasterlist missing from GS_RasterList.
- ERR_DISKFULL, -> Disk full error.
- ERR_FILEMISSING, -> File not found.
- ERR_WRONGVER, -> Wrong version or version not supported.
- ERR_MONITOR, -> Monitor driver not found or cannot be used.
- ERR_UNPACK -> Problem with unpacking of data.
-
- CONST ERR_SUCCESS = 0 -> Synonym for ERR_OK.
-
- ->**************************************************************************
- ->* Memory types used by AllocMemBlock(). This is almost identical to the
- ->* exec definition but CHIP is renamed to VIDEO (displayable memory) and
- ->* there is an addition of BLIT and SOUND specific memory. CLEARed memory
- ->* is redundant (all GMS memory is cleared on allocation), REVERSE and
- ->* NO_EXPUNGE are also unused.
-
- CONST MEM_ANY = $00000000,
- MEM_CLEAR = $00000000,
- MEM_VIDEO = $00000002,
- MEM_BLIT = $00000004,
- MEM_SOUND = $00000008
-
- ->***************************************************************************
- ->* File Object.
-
- CONST FL_READ = $00000000,
- FL_WRITE = $00000001,
- FL_LOCK = $00000002,
- FL_NEW = $00000004,
- FL_FIND = $00000008,
- FL_UNPACK = $00000010,
- FL_SMART = $00000018
-
- CONST FLV1 = $464C0000
-
- OBJECT file
- id :LONG -> FLV1
- stats :LONG -> Private.
- name :LONG -> Pointer to name of the file on disk.
- bytepos :LONG -> Current position in file.
- size :LONG -> Total size of the file.
- flags :LONG -> File flags.
- ENDOBJECT
-
- ->**************************************************************************
- ->* Universal joystick status bits returned from ReadJoystick, Sega,
- ->* JoyPad, etc...
-
- CONST JT_SWITCH = 0, -> Joystick return types.
- JT_ZBXY = 1,
-
- JS_LEFT = $00000001, -> Joy Switches.
- JS_RIGHT = $00000002,
- JS_UP = $00000004,
- JS_DOWN = $00000008,
- JS_ZIN = $00000010,
- JS_ZOUT = $00000020,
-
- JS_FIRE1 = $00010000, -> Fire Buttons
- JS_FIRE2 = $00020000, -> For 2 button joysticks
- JS_FIRE3 = $00040000, -> For 3 button joysticks
- JS_FIRE4 = $00080000,
- JS_FIRE5 = $00100000,
- JS_FIRE6 = $00200000,
- JS_FIRE7 = $00400000,
- JS_FIRE8 = $00800000,
-
- JS_RED = $00010000,
- JS_BLUE = $00020000,
- JS_PLAY = $00040000, -> CD32 buttons here
- JS_RWD = $00080000,
- JS_FFW = $00100000,
- JS_GREEN = $00200000,
- JS_YELLOW = $00400000,
-
- MB_LMB = $00010000, -> Mouse button flags returned from
- MB_RMB = $00020000, -> ReadMouse(), in ZBXY format
- MB_MMB = $00040000
-
- -> Joyport specifications for calling ReadJoyStick/Mouse/JoyPad...
-
- CONST JPORT1 = 0*2,
- JPORT2 = 1*2,
- JPORT3 = 2*2,
- JPORT4 = 3*2
-
- OBJECT joydata
- xchange :INT
- ychange :INT
- zchange :INT
- buttons :INT
- ENDOBJECT
-
- CONST JD_FIRE1 = $0001, -> Standard Fire Button (1) - LMB.
- JD_FIRE2 = $0002, -> Standard Fire Button (2) - RMB.
- JD_FIRE3 = $0004, -> Standard Fire Button (3) - MMB.
- JD_FIRE4 = $0008,
- JD_FIRE5 = $0010,
- JD_FIRE6 = $0020,
- JD_FIRE7 = $0040,
- JD_FIRE8 = $0080,
-
- JD_LMB = $0001,
- JD_RMB = $0002,
- JD_MMB = $0004
-
- PROC getZBXYx(zb)
- DEF ret:LONG
- MOVE.L zb,D0
- ASR.W #8,D0
- MOVE.L D0,ret
- RETURN ret
- ENDPROC
-
- PROC getZBXYy(zb)
- DEF ret:LONG
- MOVE.L zb,D0
- EXT.W D0
- EXT.L D0
- MOVE.L D0,ret
- RETURN ret
- ENDPROC
-
- ->***************************************************************************
- ->* GPI ID numbers.
-
- CONST GPI_SCREENS = 0,
- GPI_BLITTER = 4,
- GPI_SOUND = 8,
- GPI_NETWORK = 12,
- GPI_VECTORS = 16,
- GPI_FIREBALL = 20,
- GPI_MOVIE = 24,
- GPI_CARDS = 28,
- GPI_TEXT = 32,
- GPI_OBJECTS = 36,
- GPI_ANIM = 40
-
- ->***************************************************************************
- ->* Standard screen structure.
-
- CONST GSV1 = $47530000 -> Structure ID (goes in gamescreen.version)
-
- OBJECT gamescreen
- version :LONG -> Structure version - GSV1
- stats :LONG -> Private
- memptr1 :LONG -> Ptr to screen 1
- memptr2 :LONG -> Ptr to screen 2 (double buffer)
- memptr3 :LONG -> Ptr to screen 3 (triple buffer)
- screenlink :LONG -> Ptr to a linked screen
- palette :LONG -> Ptr to the screen palette
- rasterlist :LONG -> Ptr to a rasterlist
- amtcolours :LONG -> The amount of colours in the palette.
- scrwidth :INT -> The width of the visible screen
- scrheight :INT -> The height of the visible screen
- picwidth :INT -> The width of the picture in pixels.
- picbytewidth :INT -> The width of the picture in bytes.
- picheight :INT -> The height of the entire screen
- planes :INT -> The amount of planes in da screen
- scrxoffset :INT -> Hardware co-ordinate for TOS
- scryoffset :INT -> Hardware co-ordinate for LOS
- picxoffset :INT -> Offset of the horizontal axis
- picyoffset :INT -> Offset of the vertical axis
- attrib :LONG -> Special Attributes are?
- scrmode :INT -> What screen mode is it?
- scrtype :INT -> Interleaved/Planar/Chunky?
- task :LONG -> Task that owns this screen.
- ENDOBJECT
-
- CONST BUFFER1 = 8,
- BUFFER2 = 12,
- BUFFER3 = 16
-
- -> SCREEN ATTRIBUTES (attrib)
-
- CONST DBLBUFFER = $00000001, -> For double buffering
- TPLBUFFER = $00000002, -> Triple buffering!!
- PLAYFIELD = $00000004, -> Set if it's part of a playfield
- HSCROLL = $00000008, -> Gotta set this to do scrolling
- VSCROLL = $00000010, -> For vertical scrolling
- SPRITES = $00000020, -> Set this if you want sprites
- SBUFFER = $00000040, -> Creates a scroll buff for up to 100 screens.
- CENTRE = $00000080, -> Centres the screens (sets XOffset/YOffset).
- BLKBDR = $00000100, -> Gives a blackborder on AGA machines
- NOSCRBDR = $00000200 -> For putting sprites in the border
-
- -> SCREEN TYPES (type)
-
- CONST INTERLEAVED = 1, -> These are actual numbers, not bits.
- ILBM = 1,
- PLANAR = 2,
- CHUNKY8 = 3,
- CHUNKY16 = 4,
- TRUECOLOUR = 5
-
- -> SCREEN MODES (mode)
-
- CONST HIRES = $0001, -> High resolution
- SHIRES = $0002, -> Super-High resolution
- LACED = $0004, -> Interlaced
- LORES = $0008, -> Low resolution (default)
- EXTRAHB = $0010, -> Extra HalfBrite
- SLACED = $0020, -> Super-Laced resolution.
- HAM = $0040 -> For HAM mode
-
- #define WAITLINE(a) Shl(00,16) OR (a),0
- #define COLOUR(a,b) Shl(02,16),(a),(b),0
- #define NEWPALETTE(a,b,c) Shl(04,16),(a),(b),(c),0
- #define COLOURLIST(a,b,c,d) Shl(06,16) OR (a),Shl(b,16) OR (c),(d),0
- #define SPRITE(a) Shl(08,16) OR (a),0
- #define SCROLL(a,b,c) Shl(10,16) OR (a),Shl(b,16) OR (c),0
- #define FSCROLL(a,b,c,d) Shl(12,16) OR (a),Shl(b,16) OR (c),Shl(d,16),0
- #define FLOOD Shl(14,16),0
- #define REPOINT(a) Shl(16,16),(a),0
- #define MIRROR Shl(18,16),0
- #define RASTEND $ffffffff
-
- /* Screen tags */
-
- CONST GSA_MEMPTR1 = $C0000008,
- GSA_MEMPTR2 = $C000000C,
- GSA_MEMPTR3 = $C0000010,
- GSA_SCREENLINK = $C0000014,
- GSA_PALETTE = $C0000018,
- GSA_RASTERLIST = $C000001C,
- GSA_AMTCOLOURS = $80000020,
- GSA_SCRWIDTH = $40000024,
- GSA_SCRHEIGHT = $40000026,
- GSA_PICWIDTH = $40000028,
- GSA_PICBYTEWIDTH = $4000002A,
- GSA_PICHEIGHT = $4000002C,
- GSA_PLANES = $4000002E,
- GSA_SCRXOFFSET = $40000030,
- GSA_SCRYOFFSET = $40000032,
- GSA_PICXOFFSET = $40000034,
- GSA_PICYOFFSET = $40000036,
- GSA_SCRATTRIB = $80000038,
- GSA_SCRMODE = $4000003C,
- GSA_SCRTYPE = $4000003E
-
- ->***************************************************************************
- ->* Sprite structure.
-
- CONST SPV1 = $53500000
-
- OBJECT sprite
- version :LONG -> Structure version (SPV1)
- stats :LONG -> Reserved.
- number :INT -> Bank number to access
- data :LONG -> Pointer to Sprite graphic
- xpos :INT -> X position
- ypos :INT -> Y position
- frame :INT -> Frame number
- width :INT -> Width in pixels
- height :INT -> Height in pixels
- amtcolours :INT -> 4 or 16
- colstart :INT -> Colour bank to access, increments of 16
- planes :INT -> Amount of planes per bank
- scrmode :INT -> HiRes/LoRes/SHiRes
- fieldpos :INT -> Field position in relation to playfields
- attrib :INT -> Attributes (XLONG)
- ENDOBJECT
-
- CONST XLONG = $0001
-
- CONST SPA_NUMBER = $40000008,
- SPA_DATA = $C000000A,
- SPA_XCOORD = $4000000E,
- SPA_YCOORD = $40000010,
- SPA_FRAME = $40000012,
- SPA_WIDTH = $40000014,
- SPA_HEIGHT = $40000016,
- SPA_AMTCOLOURS = $40000018,
- SPA_COLSTART = $4000001A,
- SPA_PLANES = $4000001C,
- SPA_SCRMODE = $4000001E,
- SPA_FIELDPRI = $40000020,
- SPA_ATTRIB = $40000022
-
- ->***************************************************************************
- ->* BOB structure for BBV1.
-
- CONST BBV1 = $42420000
-
- OBJECT bob
- version :LONG -> Structure version BBV1.
- stats :LONG -> Private.
- buffer :INT -> Buffer1/Buffer2/Buffer3
- gfxdata :LONG -> Pointer to base of BOB graphics.
- maskdata :LONG -> Pointer to base of BOB masks.
- frame :INT -> Current frame.
- framelist :LONG -> Pointer to frame list.
- srcwidth :INT -> Modulo (skip in source) in bytes.
- width :INT -> Width in pixels.
- bytewidth :INT -> Width in bytes.
- height :INT -> Height in pixels.
- xcoord :INT -> To X pixel.
- ycoord :INT -> To Y pixel.
- clipLX :INT -> Left X border in bytes (0/8)
- clipTY :INT -> Top Y border (0)
- clipRX :INT -> Right X border in bytes (320/8)
- clipBY :INT -> Bottom Y border (256)
- fplane :INT -> 1st Plane to blit to (planar only)
- planes :INT -> Amount of planes
- planesize :LONG -> Size Of Plane Source (planar only)
- attrib :LONG -> Attributes like CLIP and MASK.
- picture :LONG -> Pointer to a picture struct (bob origin).
- ENDOBJECT
-
- CONST BBA_GfxData = $C0000008,
- BBA_MaskData = $C000000C,
- BBA_Frame = $40000010,
- BBA_FrameList = $C0000012,
- BBA_SrcWidth = $40000016,
- BBA_Width = $40000018,
- BBA_ByteWidth = $4000001A,
- BBA_Height = $4000001C,
- BBA_XCoord = $4000001E,
- BBA_YCoord = $40000020,
- BBA_ClipLX = $40000022,
- BBA_ClipTY = $40000024,
- BBA_ClipRX = $40000026,
- BBA_ClipBY = $40000028,
- BBA_FPlane = $4000002A,
- BBA_Planes = $4000002C,
- BBA_PlaneSize = $8000002E,
- BBA_Attrib = $80000032,
- BBA_Picture = $C0000036
-
- /* Multple BOB structure */
-
- CONST MBV1 = $424D0000
-
- OBJECT mbob
- version :LONG -> Structure version MBV1.
- stats :LONG -> Private.
- buffer :INT -> Buffer1/Buffer2/Buffer3
- gfxdata :LONG -> Pointer to base of BOB graphics.
- maskdata :LONG -> Pointer to base of BOB masks.
- amtentries :INT -> Amount of entries.
- framelist :LONG -> Pointer to frame list.
- srcwidth :INT -> Modulo (skip in source) in bytes.
- width :INT -> Width in pixels.
- bytewidth :INT -> Width in bytes.
- height :INT -> Height in pixels.
- entrylist :LONG -> Pointer to entry list.
- clipLX :INT -> Left X border in bytes (0/8)
- clipTY :INT -> Top Y border (0)
- clipRX :INT -> Right X border in bytes (320/8)
- clipBY :INT -> Bottom Y border (256)
- fplane :INT -> 1st Plane to blit to (planar only)
- planes :INT -> Amount of planes
- planesize :LONG -> Size Of Plane Source (planar only)
- attrib :LONG -> Attributes like CLIP and MASK.
- picture :LONG -> Pointer to a picture struct (bob origin).
- entrysize :INT -> Size of each entry in the list.
- ENDOBJECT
-
- OBJECT framelist
- gfx_xcoord :INT
- gfx_ycoord :INT
- msk_xcoord :INT
- msk_ycoord :INT
- ENDOBJECT
-
- CONST CLIP = $00000001,
- MASK = $00000002,
- STILL = $00000004,
- CLEAR = $00000008,
- RESTORE = $00000010,
- DIRECT = $00000020,
- FILLMASK = $00000040,
- GENMASK = $00000082,
- GENMASKS = $00000082,
- CLRMASK = $00000100,
- CLRNOMASK = $00000000
-
- CONST SKIPIMAGE = 32000,
- SKIPPIXEL = -32000
-
- ->***************************************************************************
- ->* The picture structure for loading and depacking of pictures.
-
- CONST PCV1 = $50430000
-
- OBJECT picture
- version :LONG -> PCV1
- stats :LONG -> Reserved.
- data :LONG -> Source.
- width :INT -> Picture width
- bytewidth :INT -> Picture byte width
- height :INT -> Picture height
- planes :INT -> Amount of planes
- amtcolours :LONG -> Amount of colours.
- palette :LONG -> Pointer to Palette.
- scrmode :INT -> Intended screen mode for picture.
- scrtype :INT -> Interleaved/Chunky/Planar
- options :LONG -> GETPALETTE/VIDEOMEM/REMAP...
- file :LONG -> Where this picture comes from.
- ENDOBJECT
-
- CONST PCA_DATA = $C0000008,
- PCA_WIDTH = $4000000C,
- PCA_BYTEWIDTH = $4000000E,
- PCA_HEIGHT = $40000010,
- PCA_PLANES = $40000012,
- PCA_AMTCOLOURS = $80000014,
- PCA_PALETTE = $C0000018,
- PCA_SCRMODE = $4000001C,
- PCA_SCRTYPE = $4000001E,
- PCA_OPTIONS = $80000020,
- PCA_FILE = $C0000024
-
- CONST GETPALETTE = $00000001,
- VIDEOMEM = $00000002,
- REMAP = $00000004,
- GETVMODE = $00000008,
- RESIZEX = $00000010,
- BLITMEM = $00000020,
- RESIZEY = $00000040,
- RESIZE = $00000050
-
- ->***************************************************************************
- ->* Choose one of these for calling Set_Interrupt().
-
- CONST INTB_INTEN = 14, -> Master interrupt (enable only )
- INTB_EXTER = 13, -> External interrupt
- INTB_DSKSYNC = 12, -> Disk re-SYNChronized
- INTB_RBF = 11, -> serial port Receive Buffer Full
- INTB_AUD3 = 10, -> Audio channel 3 block finished
- INTB_AUD2 = 9, -> Audio channel 2 block finished
- INTB_AUD1 = 8, -> Audio channel 1 block finished
- INTB_AUD0 = 7, -> Audio channel 0 block finished
- INTB_BLIT = 6, -> Blitter finished
- INTB_VERTB = 5, -> start of Vertical Blank
- INTB_COPER = 4, -> Coprocessor
- INTB_PORTS = 3, -> I/O Ports and timers
- INTB_SOFTINT = 2, -> software interrupt rest
- INTB_DSKBLK = 1, -> Disk Block done
- INTB_TBE = 0 -> serial port Transmit Buffer Empty
-
- ->***************************************************************************
- ->*
-
- OBJECT keys
- id :INT
- key1 :CHAR
- key2 :CHAR
- key3 :CHAR
- key4 :CHAR
- ENDOBJECT
-
- ->***************************************************************************
- ->* Special Keypresses that can be returned from Read_Key(). All other
- ->* keys can be considered to be in ASCII format.
-
- CONST K_SCS = $80, -> Screen switch (LEFTAMIGA + M)
- K_DEL = $81,
- K_HELP = $82,
- K_LSHIFT = $83,
- K_RSHIFT = $84,
- K_CAPS = $85,
- K_CTRL = $86,
- K_LALT = $87,
- K_RALT = $88,
- K_LAMIGA = $89,
- K_RAMIGA = $8a,
-
- K_F1 = $8b,
- K_F2 = $8c,
- K_F3 = $8d,
- K_F4 = $8e,
- K_F5 = $8f,
- K_F6 = $90,
- K_F7 = $91,
- K_F8 = $92,
- K_F9 = $93,
- K_F10 = $94,
- K_F11 = $95,
- K_F12 = $96,
- K_F13 = $97,
- K_F14 = $98,
- K_F15 = $99,
- K_F16 = $9a,
- K_F17 = $9b,
- K_F18 = $9c,
- K_F19 = $9d,
- K_F20 = $9e,
-
- C_UP = $9f,
- C_DOWN = $a0,
- C_RIGHT = $a1,
- C_LEFT = $a2,
-
- K_SRIGHT = $a3, -> Special key on right
- K_SLEFT = $a4, -> Special key on left
-
- K_TAB = 09,
- K_BAKSPC = 08,
- K_ENTER = 10,
- K_RETURN = 10,
- K_ESC = $1b
-